<?php
namespace app\mobile\controller;
use think\Db;
class NewsController extends WechatController
{
    public function details()
    {
    	$id = input('id/d',0);
    	$news = Db::name('portal_post')->find($id);
    	$author_name = Db::name('user')->where('id',$news["user_id"])->value('user_nickname');
    	$news["author_name"]=$author_name;
    	$this->assign('news',$news);
        return $this->fetch();
    }
    public function index(){
    	$volunt_news = Db::name('portal_post')->where('post_type',1)->field('id,post_title,thumbnail,published_time')->order('published_time desc')->select();
    	$new_news = Db::name('portal_post')->where('post_type',3)->field('id,post_title,thumbnail,published_time')->order('published_time desc')->select();
    	$this->assign('volunt_news',$volunt_news);
    	$this->assign('new_news',$new_news);
    	return $this->fetch();
    }
}
